package com.huike.clues.service.impl;

import com.huike.clues.domain.TbCourse;
import com.huike.clues.mapper.TbCourseMapper;
import com.huike.clues.service.ITbCourseService;
import com.huike.common.utils.StringUtils;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author EthanRuins
 * @date 2023/7/13
 * @apiNote
 */
@Service
@AllArgsConstructor
public class TbCourseServiceImpl implements ITbCourseService {
    private final TbCourseMapper courseMapper;

    @Override
    public int insert(TbCourse course) {
        course.setCode(StringUtils.getRandom(8));
        return courseMapper.insert(course);
    }

    @Override
    public int update(TbCourse course) {
        return courseMapper.update(course);
    }

    @Override
    public int deleteById(Long id) {
        return courseMapper.deleteById(id);
    }

    @Override
    public int deleteByIds(Long[] ids) {
        return courseMapper.deleteByIds(ids);
    }

    @Override
    public TbCourse getById(Long id) {
        return courseMapper.getById(id);
    }

    @Override
    public List<TbCourse> getList(TbCourse course) {
        return courseMapper.getList(course);
    }
}
